/**
 * Copyright 2009-2010 - YangJiandong(chunquedong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 你可以自由复制、传播本项目的下载包文件，但必须保持其完整性。
 * 我们不用对使用中的风险及由此造成的损失承担任何责任。
 * 详细情况请见《ChunMap许可协议》。

 * 想了解更多有关ChunMap的信息，请访问http://code.google.com/p/chunmap/
 */
package chunmap.util;

/**
 * 我的断言
 * @author chunquedong
 * 
 */
public class MyAssert {
	public static void equals(Object obj, Object other) {
		if (!obj.equals(other)) {
			throw new AssertionEexception("not equals");
		}
	}

	public static void notNull(Object obj) {
		if (obj == null) {
			throw new AssertionEexception("null pointer");
		}
	}

	public static void notNull(Object ...objects) {
		for (Object obj : objects) {
			if (obj == null) {
				throw new AssertionEexception("null pointer");
			}
		}
	}

	public static void isTrue(boolean condition) {
		if (!condition) {
			throw new AssertionEexception("null pointer");
		}
	}

	public static void unreachableCode() {
		throw new AssertionEexception("unreachable code");
	}

	public static class AssertionEexception extends ChunMapRuntimeException {
		private static final long serialVersionUID = -650206381011080688L;

		public AssertionEexception(String message) {
			super(message);
		}
	}
}
